Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added uninitialized for Queue #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Neo-Zhixing
Copy link

@Neo-Zhixing Neo-Zhixing commented Nov 11, 2020

Certain functions in ESP-IDR (for example uart_driver_install ) asks for an uninitialized Queue pointer. This creates an additional method in Queue to creates an uninitialized queue so that they could be initialized by something else.

@rudib
Copy link
Member

rudib commented Nov 13, 2020

What else could then initialize this queue since the field member holding the pointer to the queue is private?

If this is really needed (and this goes for other FreeRTOS.rs wrappers as well), I'd much prefer to have a constructor API that mimics those from Rust's stdlib:

pub unsafe fn from_raw(ptr: FreeRtosQueueHandle) -> Result<Self, FreeRtosError> {
  // .,..
}

Optionally, this method could also do a sanity check by calling a peek or count method on the queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants